<%@language=vbscript%>
<% 
	Session("FormName")="F44"
	Session("VanBan")=""
%>
<!--#include file="..\CheckSession.inc"-->
<!--#include file=..\getFormName.inc-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Language" content="vi">
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
</head>
<!--#include file="..\jvGrid.inc"-->
<!--#include file="..\RootContent.inc"-->
<!--#include file="..\pageSelected.inc"-->
<%	
	bComm=Request("bComm")	
	sort=request("sort")
	bID=Request("bID")
	bchon=Request("bchon")
	Select case bComm
		case "search"
			bsoden=Request("bSoden")
			bdenso=Request("bDenso")
			bnbdxl=Request("bnbdxl")
			bhxl=Request("bhxl")
			bnht=Request("bnht")
			bskh=Request("bSKH")
			bdv=Request("bdv")
			bty=Request("bty")
			bttxl=Request("bttxl")
			sDieuKien=""
			if bty<>"" then
				if sDieuKien <> "" then
					sDieuKien=sDieuKien + " And vtden.Trichyeu Like '"& bty &"' "
				else
					sDieuKien=" vtden.Trichyeu Like '"& bty &"' "
				end if
			end if
			if bskh<>"" then
				if sDieuKien <> "" then
					sDieuKien=sDieuKien + " And vtden.Sogoc like '"& bskh &"' "
				else
					sDieuKien=" vtden.Sogoc like '"& bskh &"' "
				end if
			end if
			if bSoden<>"" then
				if sDieuKien <> "" then			 
					sDieuKien=sDieuKien + " And vtden.Soghinhan >= '"& bSoden &"' "
				else
					sDieuKien=" vtden.Soghinhan >= '"& bSoden &"' "
				end if
			end if
			if bDenso<>"" then
				if sDieuKien <> "" then			 
					sDieuKien=sDieuKien + " And vtden.Soghinhan <= '"& bDenso &"' "
				else
					sDieuKien=" vtden.Soghinhan <= '"& bDenso &"' "
				end if
			end if
			if bchon="all" then	
				if bdv= "" then
					if bnbdxl <> "" then
						if sDieuKien <> "" then
							sDieuKien=sDieuKien + " And vtden.ngaybatdau = '"& SaveDate(bnbdxl) &"' "
						else
							sDieuKien=" vtden.ngaybatdau = '"& SaveDate(bnbdxl) &"' "
						end if
					end if
					if bhxl <> "" then
						if sDieuKien <> "" then
							sDieuKien=sDieuKien + " And vtden.thxl = '"& SaveDate(bhxl) &"' "
						else
							sDieuKien=" vtden.thxl = '"& SaveDate(bhxl) &"' "
						end if
					end if
					select case bttxl
						case "DH"
							if sDieuKien <> "" then
								sDieuKien=sDieuKien + " And vtden.id in (Select vtden.id from VTDen where vtden.masotc in ('01','02.01','02.02','02.03','03','04.01','04.02','04.03','04.04','05.01','05.02','06','07.01','07.02','07.03','07.04','07.05','07.06','07.07','07.08') and vtden.congcong=0 and vtden.trangthaiduyet=1 and vtden.ngaynhan>='"& Session("Year") &"' and vtden.thxl >= (select max(ngayhtxl) from hoanthanhxl where idvtden = vtden.id)) "
							else
								sDieuKien=" vtden.id in (Select vtden.id from VTDen where vtden.masotc in ('01','02.01','02.02','02.03','03','04.01','04.02','04.03','04.04','05.01','05.02','06','07.01','07.02','07.03','07.04','07.05','07.06','07.07','07.08') and vtden.congcong=0 and vtden.trangthaiduyet=1 and vtden.ngaynhan>='"& Session("Year") &"' and vtden.thxl >= (select max(ngayhtxl) from hoanthanhxl where idvtden = vtden.id)) "
							end if
						case "QH"
							if sDieuKien <> "" then
								sDieuKien=sDieuKien + " And vtden.id in (Select vtden.id from VTDen where vtden.masotc in ('01','02.01','02.02','02.03','03','04.01','04.02','04.03','04.04','05.01','05.02','06','07.01','07.02','07.03','07.04','07.05','07.06','07.07','07.08') and vtden.congcong=0 and vtden.trangthaiduyet=1 and vtden.ngaynhan>='"& Session("Year") &"' and ( vtden.thxl < '"& date() &"' or vtden.thxl < (select max(ngayhtxl) from hoanthanhxl where idvtden = vtden.id))) "
							else
								sDieuKien=" vtden.id in (Select vtden.id from VTDen where vtden.masotc in ('01','02.01','02.02','02.03','03','04.01','04.02','04.03','04.04','05.01','05.02','06','07.01','07.02','07.03','07.04','07.05','07.06','07.07','07.08') and vtden.congcong=0 and vtden.trangthaiduyet=1 and vtden.ngaynhan>='"& Session("Year") &"' and ( vtden.thxl < '"& date() &"' or vtden.thxl < (select max(ngayhtxl) from hoanthanhxl where idvtden = vtden.id))) "
							end if
						Case "CXL"
							if sDieuKien <> "" then
								sDieuKien=sDieuKien + " And vtden.id not in (Select distinct vtden.id from VTDen inner join hoanthanhxl on VTDen.id=hoanthanhxl.idvtden where vtden.masotc in ('01','02.01','02.02','02.03','03','04.01','04.02','04.03','04.04','05.01','05.02','06','07.01','07.02','07.03','07.04','07.05','07.06','07.07','07.08') and vtden.congcong=0 and vtden.trangthaiduyet=1 and vtden.ngaynhan>='"& Session("Year") &"') "
							else
								sDieuKien=" vtden.id not in (Select distinct vtden.id from VTDen inner join hoanthanhxl on VTDen.id=hoanthanhxl.idvtden where vtden.masotc in ('01','02.01','02.02','02.03','03','04.01','04.02','04.03','04.04','05.01','05.02','06','07.01','07.02','07.03','07.04','07.05','07.06','07.07','07.08') and vtden.congcong=0 and vtden.trangthaiduyet=1 and vtden.ngaynhan>='"& Session("Year") &"') "
							end if
					end select
					if sDieuKien <> "" then
						sDieuKien=" and "+ sDieuKien
					end if
					sSQl="Select vtden.*,(select max(ngayhtxl) from hoanthanhxl where idvtden = vtden.id) as maxngayht from VTDen where vtden.masotc in ('01','02.01','02.02','02.03','03','04.01','04.02','04.03','04.04','05.01','05.02','06','07.01','07.02','07.03','07.04','07.05','07.06','07.07','07.08') and vtden.congcong=0 and vtden.trangthaiduyet=1 and vtden.ngaynhan>='"& Session("Year") &"' "& sDieuKien &" order by soghinhan DESC,ngaynhan desc "
				else
						if bnbdxl <> "" then
							if sDieuKien <> "" then
								sDieuKien=sDieuKien + " And ykxl_hxl.nbdxuly = '"& SaveDate(bnbdxl) &"' "
							else
								sDieuKien=" ykxl_hxl.nbdxuly = '"& SaveDate(bnbdxl) &"' "
							end if
						end if
						if bhxl <> "" then
							if sDieuKien <> "" then
								sDieuKien=sDieuKien + " And ykxl_hxl.hanxuly = '"& SaveDate(bhxl) &"' "
							else
								sDieuKien=" ykxl_hxl.hanxuly = '"& SaveDate(bhxl) &"' "
							end if
						end if
						if bnht <> "" then
							if sDieuKien <> "" then
								sDieuKien=sDieuKien + " And hoanthanhxl.ngayhtxl = '"& SaveDate(bnht) &"' "
							else
								sDieuKien=" hoanthanhxl.ngayhtxl = '"& SaveDate(bnht) &"' "
							end if
						end if
						if bttxl <> "" then
							if sDieuKien <> "" then
								sDieuKien=sDieuKien + " And hoanthanhxl.ngayhtxl = '"& SaveDate(bnht) &"' "
							else
								sDieuKien=" hoanthanhxl.ngayhtxl = '"& SaveDate(bnht) &"' "
							end if
						end if
						select case bttxl
							case "DH"
								if sDieuKien <> "" then
									sDieuKien=sDieuKien + " And hoanthanhxl.ngayhtxl <= ykxl_hxl.hanxuly "
								else
									sDieuKien=" hoanthanhxl.ngayhtxl <= ykxl_hxl.hanxuly "
								end if
							case "QH"
								if sDieuKien <> "" then
									sDieuKien=sDieuKien + " And ( hoanthanhxl.ngayhtxl > ykxl_hxl.hanxuly  or ykxl_hxl.hanxuly < '"& date() &"' ) "
								else
									sDieuKien=" ( hoanthanhxl.ngayhtxl > ykxl_hxl.hanxuly  or ykxl_hxl.hanxuly < '"& date() &"' )  "
								end if
							Case "CXL"
								if sDieuKien <> "" then
									sDieuKien=sDieuKien + " And vtden.id not in (Select vtden.id from VTDen inner join ykxl_hxl on vtden.id = ykxl_hxl.idvtden and ykxl_hxl.madonvi='"& bdv &"' left outer join hoanthanhxl on ykxl_hxl.idvtden=hoanthanhxl.idvtden and ykxl_hxl.madonvi=hoanthanhxl.madonvi where vtden.masotc in ('01','02.01','02.02','02.03','03','04.01','04.02','04.03','04.04','05.01','05.02','06','07.01','07.02','07.03','07.04','07.05','07.06','07.07','07.08') and vtden.congcong=0 and vtden.trangthaiduyet=1 and vtden.ngaynhan>='"& Session("Year") &"' and hoanthanhxl.ngayhtxl <> '') "
								else
									sDieuKien=" vtden.id not in (Select vtden.id from VTDen inner join ykxl_hxl on vtden.id = ykxl_hxl.idvtden and ykxl_hxl.madonvi='"& bdv &"' left outer join hoanthanhxl on ykxl_hxl.idvtden=hoanthanhxl.idvtden and ykxl_hxl.madonvi=hoanthanhxl.madonvi where vtden.masotc in ('01','02.01','02.02','02.03','03','04.01','04.02','04.03','04.04','05.01','05.02','06','07.01','07.02','07.03','07.04','07.05','07.06','07.07','07.08') and vtden.congcong=0 and vtden.trangthaiduyet=1 and vtden.ngaynhan>='"& Session("Year") &"' and hoanthanhxl.ngayhtxl <> '') "
								end if
						end select
						if sDieuKien <> "" then
							sDieuKien=" and "+ sDieuKien
						end if
						sSQl="Select vtden.*,ykxl_hxl.hanxuly, ykxl_hxl.nbdxuly,hoanthanhxl.ngayhtxl from VTDen inner join ykxl_hxl on vtden.id = ykxl_hxl.idvtden and ykxl_hxl.madonvi='"& bdv &"' left outer join hoanthanhxl on ykxl_hxl.idvtden=hoanthanhxl.idvtden and ykxl_hxl.madonvi=hoanthanhxl.madonvi where vtden.masotc in ('01','02.01','02.02','02.03','03','04.01','04.02','04.03','04.04','05.01','05.02','06','07.01','07.02','07.03','07.04','07.05','07.06','07.07','07.08') and vtden.congcong=0 and vtden.trangthaiduyet=1 and vtden.ngaynhan>='"& Session("Year") &"' "& sDieuKien &" order by soghinhan DESC,ngaynhan desc "
				end if
			else
				if bnbdxl <> "" then
					if sDieuKien <> "" then
						sDieuKien=sDieuKien + " And ykxl_hxl.nbdxuly = '"& SaveDate(bnbdxl) &"' "
					else
						sDieuKien=" ykxl_hxl.nbdxuly = '"& SaveDate(bnbdxl) &"' "
					end if
				end if
				if bhxl <> "" then
					if sDieuKien <> "" then
						sDieuKien=sDieuKien + " And ykxl_hxl.hanxuly = '"& SaveDate(bhxl) &"' "
					else
						sDieuKien=" ykxl_hxl.hanxuly = '"& SaveDate(bhxl) &"' "
					end if
				end if
				if bnht <> "" then
					if sDieuKien <> "" then
						sDieuKien=sDieuKien + " And hoanthanhxl.ngayhtxl = '"& SaveDate(bnht) &"' "
					else
						sDieuKien=" hoanthanhxl.ngayhtxl = '"& SaveDate(bnht) &"' "
					end if
				end if
				if bttxl <> "" then
					if sDieuKien <> "" then
						sDieuKien=sDieuKien + " And hoanthanhxl.ngayhtxl = '"& SaveDate(bnht) &"' "
					else
						sDieuKien=" hoanthanhxl.ngayhtxl = '"& SaveDate(bnht) &"' "
					end if
				end if
				select case bttxl
					case "DH"
						if sDieuKien <> "" then
							sDieuKien=sDieuKien + " And hoanthanhxl.ngayhtxl <= ykxl_hxl.hanxuly "
						else
							sDieuKien=" hoanthanhxl.ngayhtxl <= ykxl_hxl.hanxuly "
						end if
					case "QH"
						if sDieuKien <> "" then
							sDieuKien=sDieuKien + " And ( hoanthanhxl.ngayhtxl > ykxl_hxl.hanxuly or ykxl_hxl.hanxuly < '"& date() &"' ) "
						else
							sDieuKien=" ( hoanthanhxl.ngayhtxl > ykxl_hxl.hanxuly or or ykxl_hxl.hanxuly < '"& date() &"' ) "
						end if
					Case "CXL"
						if sDieuKien <> "" then
							sDieuKien=sDieuKien + " And vtden.id not in (Select vtden.id from VTDen inner join ykxl_hxl on vtden.id = ykxl_hxl.idvtden and ykxl_hxl.madonvi='"& Session("bMaDonVi") &"' left outer join hoanthanhxl on ykxl_hxl.idvtden=hoanthanhxl.idvtden and ykxl_hxl.madonvi=hoanthanhxl.madonvi where vtden.masotc in ('01','02.01','02.02','02.03','03','04.01','04.02','04.03','04.04','05.01','05.02','06','07.01','07.02','07.03','07.04','07.05','07.06','07.07','07.08') and vtden.congcong=0 and vtden.trangthaiduyet=1 and vtden.ngaynhan>='"& Session("Year") &"' and hoanthanhxl.ngayhtxl <> '') "
						else
							sDieuKien=" vtden.id not in (Select vtden.id from VTDen inner join ykxl_hxl on vtden.id = ykxl_hxl.idvtden and ykxl_hxl.madonvi='"& Session("bMaDonVi") &"' left outer join hoanthanhxl on ykxl_hxl.idvtden=hoanthanhxl.idvtden and ykxl_hxl.madonvi=hoanthanhxl.madonvi where vtden.masotc in ('01','02.01','02.02','02.03','03','04.01','04.02','04.03','04.04','05.01','05.02','06','07.01','07.02','07.03','07.04','07.05','07.06','07.07','07.08') and vtden.congcong=0 and vtden.trangthaiduyet=1 and vtden.ngaynhan>='"& Session("Year") &"' and hoanthanhxl.ngayhtxl <> '') "
						end if
				end select
					if sDieuKien <> "" then
						sDieuKien=" and "+ sDieuKien
					end if
					sSQl="Select vtden.*,ykxl_hxl.hanxuly, ykxl_hxl.nbdxuly,hoanthanhxl.ngayhtxl from VTDen inner join ykxl_hxl on vtden.id = ykxl_hxl.idvtden and ykxl_hxl.madonvi='"& Session("bMaDonVi") &"' left outer join hoanthanhxl on ykxl_hxl.idvtden=hoanthanhxl.idvtden and ykxl_hxl.madonvi=hoanthanhxl.madonvi where vtden.masotc in ('01','02.01','02.02','02.03','03','04.01','04.02','04.03','04.04','05.01','05.02','06','07.01','07.02','07.03','07.04','07.05','07.06','07.07','07.08') and vtden.congcong=0 and vtden.trangthaiduyet=1 and vtden.ngaynhan>='"& Session("Year") &"' "& sDieuKien &" order by soghinhan DESC,ngaynhan desc "
				end if
		Case else
			if bchon="all" then	
				sSQl="Select vtden.*,(select max(ngayhtxl) from hoanthanhxl where idvtden = vtden.id) as maxngayht from VTDen where vtden.masotc in ('01','02.01','02.02','02.03','03','04.01','04.02','04.03','04.04','05.01','05.02','06','07.01','07.02','07.03','07.04','07.05','07.06','07.07','07.08') and vtden.congcong=0 and vtden.trangthaiduyet=1 and vtden.ngaynhan>='"& Session("Year") &"' order by soghinhan DESC,ngaynhan desc "
			else
				sSQl="Select vtden.*,ykxl_hxl.hanxuly, ykxl_hxl.nbdxuly,hoanthanhxl.ngayhtxl from VTDen inner join ykxl_hxl on vtden.id = ykxl_hxl.idvtden and ykxl_hxl.madonvi='"& Session("bMaDonVi") &"' left outer join hoanthanhxl on ykxl_hxl.idvtden=hoanthanhxl.idvtden and ykxl_hxl.madonvi=hoanthanhxl.madonvi where vtden.masotc in ('01','02.01','02.02','02.03','03','04.01','04.02','04.03','04.04','05.01','05.02','06','07.01','07.02','07.03','07.04','07.05','07.06','07.07','07.08') and vtden.congcong=0 and vtden.trangthaiduyet=1 and vtden.ngaynhan>='"& Session("Year") &"' order by soghinhan DESC,ngaynhan desc"

			end if
	end select
	Set Rec=server.CreateObject("ADODB.Recordset")
	Rec.CursorType=3
	Rec.CacheSize=5
	Dim nRecCount	' Number of records found
	Dim nPageCount	' Number of pages of records we have
	Dim nPage	' Current page number
	nPage=CLng(request("Page"))	
	if nPage="" then nPage=1
	Rec.Open ssql,Conn
	if  rec.EOF and rec.BOF then
		nPageCount=0
	end if	
	bDisplay=Request("bDisplay")
%>	
<!--#include file="..\jvfunction.inc"-->
<script language=VBScript runat=server>
	Function FormatDate(vDate)
	   If Not IsNull(vDate) Then
	        vM = Right("0" & Month(vDate), 2)
	        vD = Right("0" & Day(vDate), 2)
	        vY = Right("19" & Year(vDate), 4)
	        FormatDate = vD & "/" & vM & "/" & vY
	   End If
	End Function
	Function ModiString(mess_s)
		message = Replace("" & mess_s,"'", "''")
		ModiString=message
	End function
	Function SaveDate(vDate)
		dim bvitri1
		dim bvitri2
	   vDate=trim(cstr(vDate))
	   bvitri1=instr(1,vDate,"/")
	   bMonth=left(vDate,bvitri1-1)
	   bvitri2=instr(bvitri1+1,vDate,"/")
	   Dim Temp
	   Temp=right(vDate,len(vDate)-bvitri1)
	   bDay=left(Temp,bvitri2-bvitri1-1)
	   bYear=right(vDate,len(vDate)-bvitri2)
       SaveDate=bDay+"/"+bMonth+"/"+bYear
	End Function
</script>
<SCRIPT LANGUAGE=javascript>
<!--
function ChangePage(){
	strURL= Noidung.page.value;
	window.Noidung.target="right";
	window.Noidung.action = strURL;
	window.Noidung.submit();
}

function CmdTimkiem_onclick(){
	remote = window.open('frmsearchtdxlvb.asp?bchon='+'<%=bchon%>','new_page','top=150,left=150,width=550,height=168').focus();
}
function CmdChitiet_onclick(){
	window.Noidung.target="_blank";
	window.Noidung.action = "noidungxlvb.asp?bid="+"<%=bID%>"+"&bchon="+"<%=bchon%>";
	window.Noidung.submit();
}
function CmdIn_onclick(){
	window.Noidung.target="_blank";
	window.Noidung.action = "frmprttdxlvb.asp?bchon="+"<%=bchon%>"+"&sDieuKien="+"<%=server.urlencode(sDieuKien)%>"+"&bdv="+"<%=bdv%>";
	window.Noidung.submit();
}
function CmdOne_onclick() {
	  window.Noidung.target="right";
	  window.Noidung.action="frmtdxlvb.asp?bChon=one";
	  window.Noidung.submit();
}

function CmdAll_onclick() {
	  window.Noidung.target="right";
	  window.Noidung.action="frmtdxlvb.asp?bChon=all";
	  window.Noidung.submit();
}
//-->
</SCRIPT>
<LINK href="../styles/styles.css" type=text/css rel=STYLESHEET>
<body bgcolor=#F8F9D9 leftmargin=2 topmargin=0 style="font-family:times new roman">
<form name="Noidung" method="post">
<Input TYPE="hidden" name="Sort" value="<%=sort%>">
  <table border="0" width="100%" bgcolor="#BDD5D0" style="Font-family:Times New Roman;font-size:12pt;BORDER-BOTTOM-STYLE: none; BORDER-LEFT-STYLE: solid; BORDER-RIGHT-STYLE: solid; BORDER-TOP-STYLE: solid;border-collapse:collapse; border-left-color:#C0C0C0; border-right-color:#C0C0C0; border-top-color:#C0C0C0; border-bottom-color:#C0C0C0">
    <tr>
      <TD WIDTH="100%" COLSPAN="6" BGCOLOR="#000080"><P ALIGN="CENTER"><FONT FACE="times new roman" COLOR="#FFFFFF" SIZE=2><b>THEO DÕI XỬ LÝ CÔNG VĂN ĐẾN</b></FONT></P></TD>
    </tr>
  </table>
<!-- Buttons -->
<table border=0 width="100%" bgcolor="#BDD5D0" cellspacing="0" cellpadding="0" style="Font-family:arial;font-size:10pt; BORDER-BOTTOM-STYLE: solid; BORDER-LEFT-STYLE: solid; BORDER-RIGHT-STYLE: solid; BORDER-TOP-STYLE: solid;border-collapse:collapse; border-left-color:#C0C0C0; border-right-color:#C0C0C0; border-top-color:#C0C0C0; border-bottom-color:#C0C0C0">
<tr>
	<td width="33%">
	<Button name="CmdTimkiem" style="height: 25; width:100%;font-family:Arial" LANGUAGE=javascript onclick="return CmdTimkiem_onclick()" accesskey="T"><u>T</u>ìm kiếm</Button>
	</td>
	<td width="33%">
	<%if bDisplay then%>
		<Button name="CmdChitiet" style="height: 25; width:100%;font-family:Arial" LANGUAGE=javascript onclick="return CmdChitiet_onclick()" accesskey="C"><u>C</u>hi tiết</Button>
	<%else%>
		<Button name="CmdChitiet" disabled style="height: 25; width:100%;font-family:Arial" LANGUAGE=javascript onclick="return CmdChitiet_onclick()" accesskey="C"><u>C</u>hi tiết</Button>
	<%end if%>
	</td>
	<td width="33%">
	<Button name="CmdIn" style="height: 25; width:100%;font-family:Arial" LANGUAGE=javascript onclick="return CmdIn_onclick()" accesskey="I"><u>I</u>n</Button>
	</td>
</tr>
</table>
<%if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),"F44",2)="1" or Session("IsAdmin") then%>
		<%if bchon="all" then%>
		<table border="0" width="100%" cellspacing="1" cellpadding="0">
			<tr BGCOLOR="#F8F9D9">
				<TD width="100%" align=center>
					<input type="radio" ID=R2 value=2  name =one style="FONT-FAMILY: Arial; LEFT: 0px; POSITION: relative " LANGUAGE=javascript onclick="return CmdOne_onclick()"><label for=R2 accesskey="c">Danh sách <u>c</u>ông văn đến của đơn vị</label>
					<input type="radio" ID=R1 value=1 checked name=all style="FONT-FAMILY: Arial; LEFT: 0px; POSITION: relative " LANGUAGE=javascript onclick="return CmdAll_onclick()"><label for=R1 accesskey="a">Danh sách t<u>ấ</u>t cả các công văn đến</label>
				</TD>
			</tr>
		</table>
		<%else%>
		<table border="0" width="100%" cellspacing="0" cellpadding="0">
			<tr BGCOLOR="#F8F9D9">
				<TD width="100%" align=center>
					<input type="radio" ID=R2 value=2 checked name =one style="FONT-FAMILY: Arial; LEFT: 0px; POSITION: relative" LANGUAGE=javascript onclick="return CmdOne_onclick()"><label for=R2 accesskey="c">Danh sách <u>c</u>ông văn đến của đơn vị</label>
					<input type="radio" ID=R1 value=1  name=all style="FONT-FAMILY: Arial; LEFT: 0px; POSITION: relative " LANGUAGE=javascript onclick="return CmdAll_onclick()"><label for=R1 accesskey="a">Danh sách t<u>ấ</u>t cả các công văn đến</label>
				</TD>
			</tr>
		</table>
		<%end if%>
<%end if%>
<!-- Danh sach cong van den -->
<table border="0" width="100%" style="Border-color:#C0C0C0; BORDER-BOTTOM-STYLE: solid; BORDER-LEFT-STYLE: solid; BORDER-RIGHT-STYLE: solid; BORDER-TOP-STYLE: solid">
		<tr bgcolor="#BDD5D0">
		<td width="4%" nowrap></td>
		<td width="10%" nowrap align="center"><b>Số đến</b></td>
        <td width="16%" nowrap><b>Số, ký hiệu</b></td>
		<td width="23%" nowrap align="center"><b>Ngày bắt đầu XL</b></td>
		<td width="23%" nowrap align="center"><b>Hạn xử lý</b></td>
		<td width="23%" nowrap align="center"><b>Ngày hoàn thành</b></td>
		</tr>
   <% 
	If Not Rec.Eof Then
		nRecCount = Rec.RecordCount
		Rec.PageSize = 20
		nPageCount = Rec.PageCount
		If nPage < 1 then
			nPage = 1			
		End If
		if nPage > nPageCount Then
			nPage=nPageCount
		end if
		cnt=(pg-1)*pgsize + 1		    
		STT=1
		rec.AbsolutePage=nPage
		howmanyrecs=0
		do while not Rec.EOF and howmanyrecs<rec.PageSize
			if (cnt/2=int(cnt/2)) then
				color="#eeeecc"
			else
				color="#F8F9D9"
			end if
			if bchon="all" then
				if bdv="" then
					if Rec("maxngayht") then
						if Rec("maxngayht") > Rec("thxl") then
							bcolorline="grey"					
						else
							bcolorline="blue"
						end if
					else
						bcolorline="red"
					end if
				else
					if Rec("ngayhtxl") then
						if Rec("ngayhtxl") > Rec("hanxuly") then
							bcolorline="grey"				
						else
							bcolorline="blue"
						end if
					else
						bcolorline="red"
					end if
				end if
			else
				if Rec("ngayhtxl") then
					if Rec("ngayhtxl") > Rec("hanxuly") then
						bcolorline="grey"				
					else
						bcolorline="blue"
					end if
				else
					bcolorline="red"
				end if
			end if
	%>
		<%if bchon="all" then%>
			<%if bdv="" then%>
				<tr id=mnu_<%=STT%> style="BORDER-RIGHT: #e7e7e7 1px solid; BORDER-TOP: #e7e7e7 1px solid; BORDER-LEFT: #e7e7e7 1px solid; COLOR: #666666; BORDER-BOTTOM: #e7e7e7 1px solid; HEIGHT: 21px; BACKGROUND-COLOR: <%=color%>"  onmouseover="javascript:MouseOverMenu('mnu_<%=STT%>')" onmouseout="javascript:MouseOutMenu('mnu_<%=STT%>','<%=color%>')">
		<%Select case Rec("Tinhchat")
			case "01"%>
				<td width="4%" align="center"><a href='xemnoidung.asp?LoaiVt=1&bMa=<%=Rec("ID")%>&bNam=<%=year(Rec("Ngaynhan"))%>' target="_blank"><p title="Xem n&#7897;i dung v&#259;n th&#432;"><IMG border=0 SRC=Thuthuong.gif></p></a></td>
			<%case "02"%>
				<td width="4%" align="center"><a href="xemnoidung.asp?LoaiVt=1&bMa=<%=Rec("ID")%>&bNam=<%=year(Rec("Ngaynhan"))%>" target="_blank"><p title="Xem n&#7897;i dung v&#259;n th&#432;"><IMG border=0 SRC=Thukhan.gif></p></a></td>
			<%case "03"%>
				<td width="4%" align="center"><a href="xemnoidung.asp?LoaiVt=1&bMa=<%=Rec("ID")%>&bNam=<%=year(Rec("Ngaynhan"))%>" target="_blank"><p title="Xem n&#7897;i dung v&#259;n th&#432;"><IMG border=0 SRC=Thumat.gif></p></a></td>
			<%Case "04"%>
				<td width="4%"><a href="xemnoidung.asp?LoaiVt=1&bMa=<%=Rec("ID")%>&bNam=<%=year(Rec("Ngaynhan"))%>" target="_blank"><p title="Xem n&#7897;i dung v&#259;n th&#432;"><IMG border=0 SRC=Thukhanmat.gif></p></a></td>
		<%end select%>		
		<td width="10%" align=center><a style='cursor:hand;color:<%=bcolorline%>;text-decoration: none' href="frmtdxlvb.asp?sort=<%=sort%>&Page=<%=nPage%>&bDisplay=True&bID=<%=Rec("ID")%>&bchon=<%=bchon%>">
		<%=Rec("soghinhan")%></a></td>
		<td width="25%" align="left"><a style='cursor:hand;color:<%=bcolorline%>;text-decoration: none' href="frmtdxlvb.asp?sort=<%=sort%>&Page=<%=nPage%>&bDisplay=True&bID=<%=Rec("ID")%>&bchon=<%=bchon%>">
		<%=Rec("Sogoc")%></a></td>	
		<td width="20%" align="center"><a style='cursor:hand;color:<%=bcolorline%>;text-decoration: none' href="frmtdxlvb.asp?sort=<%=sort%>&Page=<%=nPage%>&bDisplay=True&bID=<%=Rec("ID")%>&bchon=<%=bchon%>">
		<%=FormatDate(Rec("ngaybatdau"))%></a></td>
		<td width="20%" align="center"><a style='cursor:hand;color:<%=bcolorline%>;text-decoration: none' href="frmtdxlvb.asp?sort=<%=sort%>&Page=<%=nPage%>&bDisplay=True&bID=<%=Rec("ID")%>&bchon=<%=bchon%>"><%=FormatDate(Rec("thxl"))%></a></td>
		<td width="20%" align="center"><a style='cursor:hand;color:<%=bcolorline%>;text-decoration: none' href="frmtdxlvb.asp?sort=<%=sort%>&Page=<%=nPage%>&bDisplay=True&bID=<%=Rec("ID")%>&bchon=<%=bchon%>"><%=FormatDate(Rec("maxngayht"))%></a></td>
	</tr>
			<%else%>
						<tr id=mnu_<%=STT%> style="BORDER-RIGHT: #e7e7e7 1px solid; BORDER-TOP: #e7e7e7 1px solid; BORDER-LEFT: #e7e7e7 1px solid; COLOR: #666666; BORDER-BOTTOM: #e7e7e7 1px solid; HEIGHT: 21px; BACKGROUND-COLOR: <%=color%>"  onmouseover="javascript:MouseOverMenu('mnu_<%=STT%>')" onmouseout="javascript:MouseOutMenu('mnu_<%=STT%>','<%=color%>')">
		<%Select case Rec("Tinhchat")
			case "01"%>
				<td width="4%" align="center"><a href='xemnoidung.asp?LoaiVt=1&bMa=<%=Rec("ID")%>&bNam=<%=year(Rec("Ngaynhan"))%>' target="_blank"><p title="Xem n&#7897;i dung v&#259;n th&#432;"><IMG border=0 SRC=Thuthuong.gif></p></a></td>
			<%case "02"%>
				<td width="4%" align="center"><a href="xemnoidung.asp?LoaiVt=1&bMa=<%=Rec("ID")%>&bNam=<%=year(Rec("Ngaynhan"))%>" target="_blank"><p title="Xem n&#7897;i dung v&#259;n th&#432;"><IMG border=0 SRC=Thukhan.gif></p></a></td>
			<%case "03"%>
				<td width="4%" align="center"><a href="xemnoidung.asp?LoaiVt=1&bMa=<%=Rec("ID")%>&bNam=<%=year(Rec("Ngaynhan"))%>" target="_blank"><p title="Xem n&#7897;i dung v&#259;n th&#432;"><IMG border=0 SRC=Thumat.gif></p></a></td>
			<%Case "04"%>
				<td width="4%"><a href="xemnoidung.asp?LoaiVt=1&bMa=<%=Rec("ID")%>&bNam=<%=year(Rec("Ngaynhan"))%>" target="_blank"><p title="Xem n&#7897;i dung v&#259;n th&#432;"><IMG border=0 SRC=Thukhanmat.gif></p></a></td>
		<%end select%>		
		<td width="10%" align=center><a style='cursor:hand;color:<%=bcolorline%>;text-decoration: none' href="frmtdxlvb.asp?sort=<%=sort%>&Page=<%=nPage%>&bDisplay=True&bID=<%=Rec("ID")%>&bchon=<%=bchon%>">
		<%=Rec("soghinhan")%></a></td>
		<td width="25%" align="left"><a style='cursor:hand;color:<%=bcolorline%>;text-decoration: none' href="frmtdxlvb.asp?sort=<%=sort%>&Page=<%=nPage%>&bDisplay=True&bID=<%=Rec("ID")%>&bchon=<%=bchon%>">
		<%=Rec("Sogoc")%></a></td>	
		<td width="20%" align="center"><a style='cursor:hand;color:<%=bcolorline%>;text-decoration: none' href="frmtdxlvb.asp?sort=<%=sort%>&Page=<%=nPage%>&bDisplay=True&bID=<%=Rec("ID")%>&bchon=<%=bchon%>">
		<%=FormatDate(Rec("nbdxuly"))%></a></td>
		<td width="20%" align="center"><a style='cursor:hand;color:<%=bcolorline%>;text-decoration: none' href="frmtdxlvb.asp?sort=<%=sort%>&Page=<%=nPage%>&bDisplay=True&bID=<%=Rec("ID")%>&bchon=<%=bchon%>"><%=FormatDate(Rec("hanxuly"))%></a></td>
		<td width="20%" align="center"><a style='cursor:hand;color:<%=bcolorline%>;text-decoration: none' href="frmtdxlvb.asp?sort=<%=sort%>&Page=<%=nPage%>&bDisplay=True&bID=<%=Rec("ID")%>&bchon=<%=bchon%>"><%=FormatDate(Rec("ngayhtxl"))%></a></td>
	</tr>
			<%end if%>
		<%else%>
		<tr id=mnu_<%=STT%> style="BORDER-RIGHT: #e7e7e7 1px solid; BORDER-TOP: #e7e7e7 1px solid; BORDER-LEFT: #e7e7e7 1px solid; COLOR: #666666; BORDER-BOTTOM: #e7e7e7 1px solid; HEIGHT: 21px; BACKGROUND-COLOR: <%=color%>"  onmouseover="javascript:MouseOverMenu('mnu_<%=STT%>')" onmouseout="javascript:MouseOutMenu('mnu_<%=STT%>','<%=color%>')">
		<%Select case Rec("Tinhchat")
			case "01"%>
				<td width="4%" align="center"><a href='xemnoidung.asp?LoaiVt=1&bMa=<%=Rec("ID")%>&bNam=<%=year(Rec("Ngaynhan"))%>' target="_blank"><p title="Xem n&#7897;i dung v&#259;n th&#432;"><IMG border=0 SRC=Thuthuong.gif></p></a></td>
			<%case "02"%>
				<td width="4%" align="center"><a href="xemnoidung.asp?LoaiVt=1&bMa=<%=Rec("ID")%>&bNam=<%=year(Rec("Ngaynhan"))%>" target="_blank"><p title="Xem n&#7897;i dung v&#259;n th&#432;"><IMG border=0 SRC=Thukhan.gif></p></a></td>
			<%case "03"%>
				<td width="4%" align="center"><a href="xemnoidung.asp?LoaiVt=1&bMa=<%=Rec("ID")%>&bNam=<%=year(Rec("Ngaynhan"))%>" target="_blank"><p title="Xem n&#7897;i dung v&#259;n th&#432;"><IMG border=0 SRC=Thumat.gif></p></a></td>
			<%Case "04"%>
				<td width="4%"><a href="xemnoidung.asp?LoaiVt=1&bMa=<%=Rec("ID")%>&bNam=<%=year(Rec("Ngaynhan"))%>" target="_blank"><p title="Xem n&#7897;i dung v&#259;n th&#432;"><IMG border=0 SRC=Thukhanmat.gif></p></a></td>
		<%end select%>		
		<td width="10%" align=center><a style='cursor:hand;color:<%=bcolorline%>;text-decoration: none' href="frmtdxlvb.asp?sort=<%=sort%>&Page=<%=nPage%>&bDisplay=True&bID=<%=Rec("ID")%>&bchon=<%=bchon%>">
		<%=Rec("soghinhan")%></a></td>
		<td width="25%" align="left"><a style='cursor:hand;color:<%=bcolorline%>;text-decoration: none' href="frmtdxlvb.asp?sort=<%=sort%>&Page=<%=nPage%>&bDisplay=True&bID=<%=Rec("ID")%>&bchon=<%=bchon%>">
		<%=Rec("Sogoc")%></a></td>	
		<td width="20%" align="center"><a style='cursor:hand;color:<%=bcolorline%>;text-decoration: none' href="frmtdxlvb.asp?sort=<%=sort%>&Page=<%=nPage%>&bDisplay=True&bID=<%=Rec("ID")%>&bchon=<%=bchon%>">
		<%=FormatDate(Rec("nbdxuly"))%></a></td>
		<td width="20%" align="center"><a style='cursor:hand;color:<%=bcolorline%>;text-decoration: none' href="frmtdxlvb.asp?sort=<%=sort%>&Page=<%=nPage%>&bDisplay=True&bID=<%=Rec("ID")%>&bchon=<%=bchon%>"><%=FormatDate(Rec("hanxuly"))%></a></td>
		<td width="20%" align="center"><a style='cursor:hand;color:<%=bcolorline%>;text-decoration: none' href="frmtdxlvb.asp?sort=<%=sort%>&Page=<%=nPage%>&bDisplay=True&bID=<%=Rec("ID")%>&bchon=<%=bchon%>"><%=FormatDate(Rec("ngayhtxl"))%></a></td>
	</tr>
	<%end if%>
	<%
		if  Session("VanBan")="" then
			Session("VanBan")="-" & Rec("ID") 
		else
			Session("VanBan")=Session("VanBan") & "-" & Rec("ID") 
		end if
	%>
	<%		STT=STT+1
			Rec.MoveNext
			cnt=cnt+1
			howmanyrecs=howmanyrecs+1
	loop
	Session("VanBan")=Session("VanBan") & "-"
end if
rec.Close
set rec=nothing
%>
</table>
<br>
<table width="98%" cellspacing=0 cellpadding=0>
<tr>
<% if nPage > 0 and nPageCount >0  then %>  
	<td width="20%"><b>Trang&nbsp; <%=nPage%>/<%=nPageCount%></b></td>
	<td width= "80%" align="right">
	<% if nPageCount > 1 then %>    
		Chuyển nhanh tới trang:&nbsp;
		<select name="page" style="width:45;height: 25;font-size:8pt" size=1 onchange="javaScript:ChangePage()">
			<% for counter = 1 to nPageCount%>	
						<%if bComm<>"search"  then
							strURL= "frmtdxlvb.asp?bchon="+bchon+"&page="+ cstr(counter) + "&bComm="
						else
							strURL= "frmtdxlvb.asp?bchon="+bchon+"&page="+ cstr(counter) + "&bComm=search&TxtSogoc="+bSogoc+"&TxtTungay="+bTungay+"&TxtDenngay="+bdenngay+"&TxtTukhoa="+bTukhoa+"&TxtTrichyeu="+bTrichyeu
						end if%>
				<option value="<%=strURL%>" <%=chkSelected(counter, nPage)%>><%=counter%></option>
			<% next %>    
		</select>
		</td>                                  
	<% end if %>             
<% end if %>
  </tr>
</table>
</form>
</body>
<%
	Conn.Close
	set Conn=nothing
%>